package com.stu.wgt.test.service.Imp;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.stu.wgt.test.bean.Images;
import com.stu.wgt.test.mapper.ImagesMapper;
import com.stu.wgt.test.service.ImagesService;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * <p>
 * 服务实现类
 * </p>
 *
 * @author wgt
 * @since 2024-03-04
 */
@Service
public class ImagesServiceImpl extends ServiceImpl<ImagesMapper, Images> implements ImagesService {

    @Autowired
    ImagesMapper imagesMapper;

    @Override
    public int insert(Images images) {
        return imagesMapper.insert(images);
    }

    @Override
    public int delete(int id) {
        return imagesMapper.deleteById(id);
    }

    @Override
    public int update(Images images) {
        QueryWrapper<Images> qw = new QueryWrapper<>();
        qw.eq("id", images.getId());
        return imagesMapper.update(images, null);
    }

    @Override
    public List<Images> select() {
        return imagesMapper.selectList(null);
    }
}
